// vs_dll.cpp : Defines the exported functions for the DLL application.
//
#include<stdlib.h>
#include "LSA.Svd.h"

// A -> m:p ; B -> p:n
void matMult(int m, int p, int n, double **A, double **B, double **C) {
# pragma omp parallel for
	for (int i = 0; i < m; i++) {
		for (int k = 0; k < p; k++) {
			for (int j = 0; j < n; j++) {
				C[i][j] += A[i][k] * B[k][j];
			}
		}
	}
}

double** createNewArray(int rows, int cols)
{
	int i;
	double** value;
	value = (double **) malloc(rows * sizeof(double *));
	if (!value) {return NULL;}

	value[0] = (double *) calloc(rows * cols, sizeof(double));
	if (!value[0]) {return NULL;}

	for (i = 1; i < rows; i++) value[i] = value[i-1] + cols;
	return value;
}

int* createNew1Array(int cols)
{
	int i;
	int* value;
	value = (int*) malloc(cols * sizeof(double));
	if (!value) {return NULL;}

	return value;
}

